package java_collection.varargs;
import static java.lang.System.out;

public class VarArgsUsage {
	
	public static void main(String args[]) {
		
		favorite("Robert",
				"Color : Green",
				"Actor: Al Pacino",
				"Coffee : Cappuccino");
    }
	
	
	// varargs method can be mixed with other arguments
	public static void favorite
		(String name, String...favorites){
		
		System.out.println("Hello : " + name);
		System.out.println("Here are you favorites");
		
		for (String f: favorites){
			System.out.println(f);
		}
	}
	
	/* Error #1 */
	
	/* We can not overload varargs method, as 
	 * it will be difficult for programmers to figure out which overloading gets called
	public static void favorite(String...favorites){
		
	}*/
	
	/* Error #2 */
	
	/* Varargs can be used only in the final argument position
	public static void favorite(String...favorites, String name){
		
	}*/
}
